#!/usr/bin/env python

import sys
import whois
from pprint import pprint

domains = [
"www.google.com",
"www.fsdfsdfsdfsd.google.com",
"digg.com",
"imdb.com",
"microsoft.com",

"www.google.org",
"ddarko.org",

"google.net",
"www.asp.net",

"google.biz",
"google.info",
"google.name",

# countries
"google.pl",
"www.ddarko.pl",
"google.co.uk",
"google.jp",
"www.google.co.jp",
"google.co",
"google.de",
"yandex.ru",
"google.us",
"google.eu",
"google.me",
"google.be",
"google.it",
"google.cz",
"google.fr",
"google.sk",
"sme.sk",
"test.ez.lv",

"dfsdfsfsdf",
]

def usage():
    print "Usage: %s [domain]" % sys.argv[0]

def test(domain):
    print('-'*80)
    print(domain)
    w = whois.query(domain, ignore_returncode=1)
    if w:
        wd = w.__dict__
        for k, v in wd.items():
            print('%20s\t"%s"' % (k, v))

# testing with domain from input argument
if len(sys.argv) > 2:
    usage()
if len(sys.argv) == 2:
    test(sys.argv[1])
    sys.exit(0)

# testing with a list of domains
for d in domains:
    if d:
        test(d)
